﻿using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;

namespace MiniBlog
{
    [ServiceContract]
    public interface IMiniBlog
    {

        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "Posts/{numberOfPosts}/{numberOfSymbols}")]
        IEnumerable<PostDTO> GetPosts(string numberOfPosts, string numberOfSymbols);

        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "Test")]
        string Test();


        [OperationContract]
        [WebInvoke(
            Method = "POST",
            UriTemplate = "/PostComment",
            BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json
        )]
        //void PostMessage();
        void PostMessage(CommentPost commentPost);

    }


    [DataContract]
    public class CommentPost
    {
        [DataMember]
        public int PostId { get; set; }

        [DataMember]
        public string Author { get; set; }

        [DataMember]
        public string Body { get; set; }
    }
}
